package org.example;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-10-26
 * 14:15
 */
class Test{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        int ni=0;
        while(n>0){
            arr[ni]=sc.nextInt();
            ni++;
            n--;
        }
        int count=0;
        for(int i=0;i<arr.length;i++){
            boolean b=false;
            int min=i;
            for(int j=i;j<arr.length;j++){
                if(arr[j]<arr[min]){
                    min=j;
                    b=true;
                }
            }
           if(b){
               int tem=arr[i];
               arr[i]=arr[min];
               arr[min]=tem;
               count++;
           }
        }
        for(int k=0;k<arr.length;k++){
            if(k==arr.length-1){
                System.out.print(arr[k]);
            }else{
                System.out.print(arr[k]+" ");
            }
        }
        System.out.println();
        System.out.print(count);
    }
}